/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package similarite;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Clement
 */
public class SiftReader extends Thread {

    private Scanner scan;
    private List<List<Float>> result;
    private boolean ok;

    public boolean isOk() {
        return ok;
    }

    public void setOk(boolean ok) {
        this.ok = ok;
    }

    public List<List<Float>> getResult() {
        return result;
    }

    public void setResult(List<List<Float>> result) {
        this.result = result;
    }

    public Scanner getScan() {
        return scan;
    }

    public void setScan(Scanner scan) {
        this.scan = scan;
    }

    public SiftReader(File f) {
        result = new ArrayList();
        ok = false;
        try {
            this.scan = new Scanner(f);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(Normalisation.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void run() {
        int ligne = 0;
        while (scan.hasNext()) {
            result.add(new ArrayList());
            for (int i = 0; i < 128; i++) {
                result.get(ligne).add(Float.parseFloat(scan.next()));
            }
            ligne++;
        }
        ok = true;
    }
}
